package net.csdn.business.notify.common.dto;


import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;

/**
 * @author liushuangyi
 * @Classname SuperPageRequestDTO
 * @Description TODO
 * @Date 2020/5/11 1:04 PM
 * @Version V1.0
 */
@Getter
public abstract class SuperPageQueryDTO<T> implements Serializable {

    /**
     * 页码
     */
    protected Integer pageNum = 1;

    /**
     * 每页大小
     */
    protected Integer pageSize = 10;


    public Page<T> getPage() {
        Page<T> pagination = new Page<>(pageNum, pageSize);
        return pagination;
    }

    /**
     * fix 23.02.01 jackson deserialize Exception
     *
     * @param pageNum 页码
     */
    @JsonIgnore
    public void setPage(Integer pageNum) {
        if (pageNum != null) {
            this.pageNum = pageNum;
        }
    }

    public Integer getSize() {
        return pageSize;
    }

    public void setSize(Integer size) {
        if (size != null) {
            this.pageSize = size;
        }
    }
}
